@echo off
setlocal enabledelayedexpansion

:: 设置变量
set HOST=192.168.87.100
set PORT=30005
set USERNAME=root
set PASSWORD=123456
set DB_DIR=./db/

:: 要导出的数据库名数组
set DBS=nacos seata spark-coupon spark-order spark-rider spark-shop spark-user xxl-job

:: 循环数组中的每个数据库名，执行mysqldump命令
for %%d in (%DBS%) do (
    echo Dumping database: %%d
    mysqldump.exe -h %HOST% -P %PORT% -u%USERNAME% -p%PASSWORD% --databases %%d > %DB_DIR%%%d.sql
)